package com.shishuo.cms.util;

import java.util.HashMap;
import java.util.Map;

public class ResultFactory {

	public static Map<String, Object> createResult(String key, String msg, Map<String,Object> resultMap) {
		
		if (resultMap == null || resultMap.isEmpty()) {
			resultMap = new HashMap<String, Object>();
		}
		
		resultMap.put("result", key);
		resultMap.put("msg", msg);
		
		return resultMap;
	}
	
	public static Map<String, Object> createResult(String key, String msg) {
		return createResult(key, msg, null);
	}
	
	public static Map<String, Object> createResult(String key, Map<String,Object> resultMap) {
		return createResult(key, null, resultMap);
	}
	
	public static Map<String, Object> createMap(String key, Object resultInfo) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		resultMap.put(key, resultInfo);
		
		return resultMap;
	}
}
